<script>
export default {
  name: 'Children',
  props: {
    num: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleAdd() {
      this.$emit('update:num', this.num + 1)
    },
    handleSub() {
      this.$emit('update:num', this.num - 1)
    }
  }
}
</script>

<template>
  <span class="children">
    今天天气好，我要去洗脚 <span>洗了{{ num }}次脚</span>
    <el-button type="danger" size="mini" @click="handleSub">-1</el-button>
    <el-button type="success" size="mini" @click="handleAdd">+1</el-button>
  </span>
</template>

<style scoped lang="scss">
.el-button {
  margin-left: 10px;
}
</style>
